package com.waypolice.manager.service.impl;

import com.waypolice.manager.service.UserService;
import com.waypolice.mapper.UpmsUserMapper;
import com.waypolice.mapper.UpmsUserPermissionMapper;
import com.waypolice.pojo.UpmsUser;
import com.waypolice.pojo.UpmsUserExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;

/**
 * 警员信息接口实现类
 *
 * @author wr
 */
@Service
public class UserServiceImpl implements UserService{

	@Autowired
	private UpmsUserMapper upmsUserMapper;

    @Override
	public List<UpmsUser> findByName(String username) {
		UpmsUserExample example = new UpmsUserExample();
		UpmsUserExample.Criteria createCriteria = example.createCriteria();
		createCriteria.andUsernameEqualTo(username);
		createCriteria.andLockedEqualTo((short) 0);
		List<UpmsUser> users = upmsUserMapper.selectByExample(example);
		return users;
	}

	@Override
	public List<Map<String, Object>> findAllUser() {
		return null;
	}

	/**
	 * @author:zyp
	 * @description 根据userId获取upmsUser对象
	 * @date: 2019/3/12 11:51
	 * @return
	 */
	@Override
	public UpmsUser selectUpmsUserByUserId(Long userId) {
		return upmsUserMapper.selectByPrimaryKey(Integer.parseInt(userId.toString()));
	}
}
